import {getCodeImg} from "@/api/login"

const test = {
  namespaced: true,
  state: {
    value: 1,
    codeUrl:''
  },
  mutations: {
    SET_VALUE: (state, value) => {
      state.value = value
    },
    SET_CODEURL:(state,codeUrl)=>{
      state.codeUrl = codeUrl
    }
  },
  actions: {
    getCode({commit}) {
      return new Promise((resolve,reject) =>{
      getCodeImg().then((res) => {
        commit('SET_CODEURL',res)
        resolve(res)
      }).catch(err=>{
        reject(err)
      })
    } )
    }
  }
}


export default test
